package com.rs.game.player.dialogues;

import com.rs.game.player.QuestManager.Quests;

public class Zimberfizz extends Dialogue {

	private int npcId;	
	
	@Override
	public void start() {
		npcId = (Integer) parameters[0];
	sendNPCDialogue(npcId, 9827, "Ayyyy Matey, how can I help you today?" );
}
	@Override
	public void run(int interfaceId, int componentId) {
		if (stage == -1) {
		sendOptionsDialogue("Available Options", "Who are you?", "SoulWars cape", "Nevermind");
		stage = 2;
		} else if (stage == 2) {
			if(componentId == OPTION_1) {
			    stage = 6;
				sendEntityDialogue(IS_NPC, "Zimberfizz", 8526, 9827, "Argh my name is Zimberfizz, the teamleader, chief, boss and CEO of SoulWars.");
			}
			if(componentId == OPTION_2) {
				if(!player.getQuestManager().completedQuest(Quests.NOMADS_REQUIEM)) {
				    stage = 3;
					sendEntityDialogue(IS_NPC, "Zimberfizz", 8526, 9827, "You need to complete Nomad's requiem in order to claim this cape.");
				    return;
				} else 
					stage = 5;
					sendOptionsDialogue("Capes", "Red cape", "Blue Cape");
					return;
			}
			if(componentId == OPTION_3) {
			    stage = 4;
			}
		} else if (stage == 6) {
			stage = 2;
			sendOptionsDialogue("Available Options", "Who are you?", "SoulWars cape", "Nevermind");
		} else if (stage == 3) {
			stage = 4;
			sendEntityDialogue(IS_NPC, "Zimberfizz", 8526, 9790, "Click on the Tent to fight him!");
		} else if (stage == 4) {
			end();
		} else if (stage == 5) {
			if(componentId == OPTION_1) {
				if(player.getInventory().hasFreeSlots() && player.getInventory().containsItem(995, 1000000)) {
                player.getInventory().addItem(15432, 1);
                player.getInventory().deleteItem(995, 1000000);
				end();
				return;
				} else 
				   player.getPackets().sendGameMessage("You need 1M and a free inventory slot to claim your cape!");
				   end();
				   return;
				}
			if(componentId == OPTION_2) {
				if(player.getInventory().hasFreeSlots() && player.getInventory().containsItem(995, 1000000)) {
	                player.getInventory().addItem(15433, 1);
	                player.getInventory().deleteItem(995, 1000000);
					end();
					return;
					} else {
					   player.getPackets().sendGameMessage("You need 1M and a free inventory slot to claim your cape!");
					   end();
					   return;
					}
			}
		}
		
	}
	@Override
	public void finish() {
		
	}

}